package com.xhiji.test.order;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class CreateOrder {

    private static String createOrderNo() {
        return System.currentTimeMillis() + String.valueOf(Math.random()).replace("0.", "");
    }

    public static String getOrderIdByTime() {
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String newDate=sdf.format(new Date());
        String result="";
        Random random=new Random();
        for(int i=0;i<3;i++){
            result+=random.nextInt(10);
        }
        return newDate+result;
    }


    public static void main(String[] args) {
        System.out.println(System.currentTimeMillis());
        System.out.println(createOrderNo());
        System.out.println(getOrderIdByTime());
    }

}
